//
//  CellForRadioType.m
//  世界
//
//  Created by admin on 16/2/14.
//  Copyright © 2016年 admin. All rights reserved.
//

#import "CellForRadioType.h"

@interface CellForRadioType ()

@property (nonatomic, retain) UIImageView *imgViewForPlay;

@end

@implementation CellForRadioType


#pragma mark 重写dealloc方法
- (void)dealloc
{
    [super dealloc];
    
    [_imageView release];
    
    [_lableForTitle release];
    
    [_lableForTname release];
    
    [_imgViewForPlay release];
}




#pragma mark 重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self != nil)
    {
        //创建子控件
        self.imageView = [[UIImageView alloc] init];
        
        self.imageView.layer.borderWidth = 2;
        
        self.imageView.layer.borderColor = [[UIColor orangeColor] CGColor];
        
        [self.contentView addSubview:self.imageView];
        
        [_imageView release];
        
        
        
        self.imgViewForPlay = [[UIImageView alloc] init];
        
        self.imgViewForPlay.image = [UIImage imageNamed:@"播放"];
        
        [self.imageView addSubview:self.imgViewForPlay];
        
        [_imgViewForPlay release];
        
     
        
        
        
        self.lableForTname = [[UILabel alloc] init];
        
        [self.contentView addSubview:self.lableForTname];
        
        [_lableForTname release];
        
        
        
        
        self.lableForTitle = [[UILabel alloc] init];
        
        self.lableForTitle.textColor = [UIColor lightGrayColor];
        
        [self.contentView addSubview:self.lableForTitle];
        
        [_lableForTitle release];
        
    }
    return self;
}



#pragma mark 布局子控件
//collectionCell 的子控件的布局通常在此方法中设置
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.imageView.frame = CGRectMake(10, 20, self.contentView.frame.size.width - 20, self.contentView.frame.size.width - 20);
    
    self.imageView.layer.cornerRadius = (self.contentView.frame.size.width - 20) / 2;
    
    self.imageView.layer.masksToBounds = YES;
    
    
    
    self.imgViewForPlay.frame = CGRectMake((self.contentView.frame.size.width - 20) / 2 - 25, (self.contentView.frame.size.width - 20) / 2 - 25, 50, 50);
    
    
    
    self.lableForTname.frame = CGRectMake(3, self.imageView.frame.origin.y + self.imageView.frame.size.height + 10, self.contentView.frame.size.width - 6, 30);
    
    self.lableForTname.textAlignment = NSTextAlignmentCenter;
    
    
    
    self.lableForTitle.frame = CGRectMake(3, self.lableForTname.frame.size.height + self.lableForTname.frame.origin.y, self.contentView.frame.size.width - 6, 60);
    
    self.lableForTitle.numberOfLines = 0;
    
    self.lableForTitle.textAlignment = NSTextAlignmentCenter;
}


@end
